package com.admin.service;

import com.admin.bean.KeyWord;
import com.admin.dbdao.KeywordDao;
import com.data.util.CheckDataUtils;
import com.data.util.DatabaseIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 关键字管理
 *
 * @author:HingLo
 * @create 2017-09-11 17:13
 **/
@Service
public class KeywordService {
    @Autowired
    private KeywordDao keywordDao;


    public List<KeyWord> findAllKeywordService() {
        return keywordDao.findAllKeywordDao();

    }

    public boolean submitkeywordService(KeyWord keyWord) {
        if (!CheckDataUtils.stringUtilsID(keyWord.getId())) {
            keyWord.setId(DatabaseIdUtils.getDataIdOne());
        }

        keyWord.setCtime(new Date());
        return keywordDao.submitkeywordDao(keyWord);
    }

    public boolean delKeywordService(String id) {

        if (CheckDataUtils.stringUtilsID(id)) {
            id = id.trim();
            return keywordDao.delKeywordDao(id);
        }
        return false;
    }


}
